package com.twotiger.and.activity.account.capitalflow;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import app.twotiger.p2p.R;
import app.twotiger.p2p.R.color;

import com.twotiger.and.activity.base.BaseActivity;
import com.twotiger.and.bean.Trade;
import com.twotiger.and.util.ArithUtils;
/**
 * 
 * @Description: 
 * 交易详情
 * @Author douxy
 * @Date 2015年8月12日 下午1:37:59
 */
public class CapitalFlowDetailPage extends BaseActivity {

    private TextView text1;
    private TextView text2;
    private TextView text3;
    private TextView text4;
    private TextView text5;
    private TextView text6;
    private ImageView sub_title_left_bt;
    private TextView sub_title_center_tv;

    @Override
    protected void processLogic() {
        sub_title_center_tv.setText("交易详情");
        sub_title_left_bt.setVisibility(View.VISIBLE);
        Trade trade = (Trade) getIntent().getSerializableExtra("FLOWDETAIL");
        if(trade == null){
            trade = new Trade(); 
        }
        text1.setText(trade.getOrderId());
        text2.setText(trade.getTypePName() + "-" + trade.getTypeName());
        switch (trade.getIsIncome()) {
        case 0:
            text3.setText(ArithUtils.coverMoneyComma(trade.getAmount() +"") + "元");
            break;
        case 1:
            text3.setText("+" + ArithUtils.coverMoneyComma(trade.getAmount() +"") + "元");
            text3.setTextColor(mContext.getResources().getColor(color.capitalflow_income));
            break;
        case -1:
            text3.setText("-" + ArithUtils.coverMoneyComma(trade.getAmount() +"") + "元");
            text3.setTextColor(mContext.getResources().getColor(color.capitalflow_not_income));
            break;
        default:
            break;
        }
        text4.setText(trade.getRemark());
        text6.setText(ArithUtils.coverMoneyComma(trade.getAvaliable()+"") + "元");
    }

    @Override
    protected void setListener() {
        sub_title_left_bt.setOnClickListener(this);
    }

    @Override
    protected void findViewById(View view) {
        text1 = (TextView) view.findViewById(R.id.text1);
        text2 = (TextView) view.findViewById(R.id.text2);
        text3 = (TextView) view.findViewById(R.id.text3);
        text4 = (TextView) view.findViewById(R.id.text4);
        text5 = (TextView) view.findViewById(R.id.text5);
        text6 = (TextView) view.findViewById(R.id.text6);
        sub_title_left_bt = (ImageView) view.findViewById(R.id.sub_title_left_bt);
        sub_title_center_tv = (TextView) view.findViewById(R.id.sub_title_center_tv);
    }

    @Override
    protected void onBackPress() {
        finish();
        overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out);

    }

    @Override
    protected View loadViewLayout(LayoutInflater inflater) {
        View view = inflater.inflate(R.layout.captail_detail_layout, null);
        return view;
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
        case R.id.sub_title_left_bt:
            onBackPress();
            break;
        default:
            break;
        }

    }

}
